import { Allow, IsArray, IsBoolean, IsNotEmpty, IsOptional } from 'class-validator';

export class RoleDto {
  @IsNotEmpty()
  roleCode: string;

  @IsNotEmpty()
  roleName: string;

  @IsOptional()
  @IsArray()
  permissionIds: number[];

  @IsBoolean()
  @IsOptional()
  status?: boolean; // 角色状态
}

export class UpdateRoleDto {
  @Allow()
  roleCode: string;

  @Allow()
  roleName: string;

  @IsOptional()
  @IsArray()
  permissionIds: number[];

  @IsBoolean()
  @IsOptional()
  status?: boolean; // 角色状态
}

// 分配角色给用户
export class AssignRoleToUserDto {
  @IsArray()
  userIds: number[];
}

// 分页查询角色列表
export class GetRoleDto {
  @Allow()
  pageSize?: number;

  @Allow()
  pageNo?: number;

  @Allow()
  roleName?: string;

  // 过滤条件
  @Allow()
  status?: boolean;
}
